package com.example.demo.elasticJob;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName MyElasticJob
 * @Description TODO
 * @Author zhangshuai
 * @Date 2019/7/6 17:18
 * @Version 1.0
 **/
@Slf4j
public class MyElasticJob implements SimpleJob {


    @Override
    public void execute(ShardingContext shardingContext) {
        //打印任务相关信息,JobParameter用于传递任务的ID
        log.info("任务名: {},片数:{},id={}", shardingContext.getJobName(), shardingContext.getShardingTotalCount(), shardingContext.getJobParameter());
    }
}
